<?php

if(!isset($_SESSION)) session_start();

// CKFinder integration
$ckfinder= array();
	
if(!empty($_SESSION['login_user'])){
	$ckfinder[]= "filebrowserBrowseUrl: '".blg_get_site_url()."mod/ckfinder/ckfinder.html'";
	$ckfinder[]= "filebrowserImageBrowseUrl: '".blg_get_site_url()."mod/ckfinder/ckfinder.html?type=Images'";
	$ckfinder[]= "filebrowserFlashBrowseUrl: '".blg_get_site_url()."mod/ckfinder/ckfinder.html?type=Flash'";
	$ckfinder[]= "filebrowserUploadUrl: '".blg_get_site_url()."mod/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'";
	$ckfinder[]= "filebrowserImageUploadUrl: '".blg_get_site_url()."mod/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'";
	$ckfinder[]= "filebrowserFlashUploadUrl: '".blg_get_site_url()."mod/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'";
}

//Common confg to all editors
$config[]= "contentsCss: ['".blg_get_site_url()."default.css', '".blg_get_site_url()."mod/ckeditor/blg/blg_editor.css']";
$config[]= (is_int($vars['height'])?"height: '".$vars['height']."px'":NULL);
$config[]= (is_int($vars['width'])?"width: '".$vars['width']."px'":NULL);
$config[]= "language: 'es'";
$config[]= "skin: 'office2003'";

//Specific config
switch($vars['config']){
	case 'basic':
		$config[]= "toolbar: 'Basic'"; 
		$config[]= "enterMode: CKEDITOR.ENTER_BR";
		$config[]= "shiftEnterMode: CKEDITOR.ENTER_BR";
		$config[]= "toolbarCanCollapse: false";
		$config[]= "resize_enabled: false";		
		break;
	default:
		$config[]= "toolbar: 'Full'";
		$config= array_merge($config, $ckfinder);
		break;
}	

$config= '{'.implode(', ', array_filter($config)).'}';
